﻿import arkadium.GUIManager

class arkadium.GUIPanel extends MovieClip
{
	// **MEMBER VARIABLES**
	private var _sPanelName:String;
	//private var m_bScrimNeeded:Boolean;
	
	// **FUNCTIONS**
	private function GUIPanel()
	{
		_sPanelName = null;
		//m_bScrimNeeded = false;
	}
	
	/**************************************************************************************************\
	registerPanel - Called by the panel who extends this class in order to register itself with the 
	GUIManager for program control.
	\**************************************************************************************************/
	private function registerPanel( cPanelInstance:GUIPanel, sPanelName:String )//, cPanelInstance:GUIPanel, pGUIManagerInstance:GUIManager)
	{
		_sPanelName = sPanelName;	
		_parent.registerPanel( cPanelInstance, sPanelName );
	}
	
	/**************************************************************************************************\
	showMe - Called by the subclass to show or hide itself. The subclass should not call _visible 
	otherwise the GUIManager will not be able to track this panel correctly.
	\**************************************************************************************************/
	private function showMe( bShow:Boolean )
	{
		if ( bShow ){
			//trace("trying to show panel "+_sPanelName);
			_parent.showPanel( _sPanelName );
		}
		else{
			//trace("trying to hide panel "+_sPanelName);
			_parent.hidePanel( _sPanelName );
		}
	}
	
	/**************************************************************************************************\
	getPanelName - Returns the name of this panel.
	\**************************************************************************************************/
	public function getPanelName():String
	{
		return _sPanelName;
	}
	
	/**************************************************************************************************\
	onInitialize - Called once by the GUIManager when the game is loaded.
	\**************************************************************************************************/
	public function onInitialize()
	{
		//trace( "GUIPanel: onInitialize() - \"" + _sPanelName + "\" this should be overwritten." );
	}
	
	/**************************************************************************************************\
	showPanel - Called by the GUIManager when a panel is requested to be shown.
	\**************************************************************************************************/
	public function showPanel( pParams:Object )
	{
		//trace( "GUIPanel: showPanel() - \"" + _sPanelName + "\" this should be overwritten." );
	}
	
	/**************************************************************************************************\
	hidePanel - Called by the GUIManager when a panel is requested to be hidden.
	\**************************************************************************************************/
	public function hidePanel()
	{
		//trace( "GUIPanel: hidePanel() - \"" + _sPanelName + "\" this should be overwritten." );
	}
	

	
	
}